<template>
  <div class="sys-user-table">
    <el-table :data="data">
      <el-table-column
        label="序号"
        prop="rowNumber"
        align="center"
        width="60"
      />
      <el-table-column
        label="姓名"
        prop="userName"
        align="center"
        min-width="10%"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="电话"
        prop="mobile"
        align="center"
        min-width="10%"
      />
      <el-table-column
        label="单位"
        prop="sysCompany.name"
        align="left"
        min-width="15%"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="部门"
        prop="sysDept.name"
        align="left"
        min-width="8%"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="类别"
        prop="category"
        align="center"
        min-width="10%"
      />
      <el-table-column
        label="角色"
        prop="sysRole.name"
        align="center"
        min-width="18%"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="是否禁用"
        align="center"
        prop="isDisabled"
        min-width="10%"
      />
      <el-table-column
        label="操作"
        align="center"
        min-width="15%"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            type="text"
            @click="handleDetail(scope.row)"
            v-hasPermi="['sys:user:detail']"
          >
            详情
          </el-button>
          <el-button
            v-if="scope.row.id !== '1'"
            type="text"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['sys:user:update']"
          >
            修改
          </el-button>
          <el-button
            type="text"
            @click="handleResetPwd(scope.row)"
            v-hasPermi="['sys:user:resetPwd']"
          >
            重置密码
          </el-button>
          <el-button
            v-if="scope.row.id !== '1'"
            type="text"
            @click="handleDelete(scope.row)"
            v-hasPermi="['sys:user:remove']"
          >
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'SysDictTable',
  props: {
    data: { type: Array, default: () => [] }
  },
  methods: {
    handleDetail(row) {
      this.$emit('row-detail', row)
    },
    handleUpdate(row) {
      this.$emit('row-update', row)
    },
    handleResetPwd(row) {
      this.$emit('row-reset-pwd', row)
    },
    handleDelete(row) {
      this.$emit('row-delete', row)
    },
  }
}
</script>

<style scoped>

</style>
